import axios from "axios";
import errorCode from "./errorCode";
import { Toast } from 'vant';

const service = axios.create({
  baseURL: "https://api.aiiiwz.love",
  timeout: 5000, // request timeout
});
service.interceptors.request.use((config) => {
  // let Token = localStorage.getItem("token");
  let Token = '';

  // 是否需要设置 token
  const isToken = (config.headers || {}).isToken === false;
  // 是否需要防止数据重复提交
  if (Token && !isToken) {
    // config.headers["Authorization"] = Token;
  }
  if (!isToken && !Token) {
    location.href = "/login";
  }
  return config;
});
export let isRelogin = {
  show: false
};
export default service;
